# ##########################################
SET( MATH_INCLUDE_FILES
	Include/Math/Ballistics.hpp
	Include/Math/Constants.hpp
	Include/Math/Math.hpp
	Include/Math/Point2i.hpp
	Include/Math/Point3f.hpp
	Include/Math/Vector3f.hpp
	Include/Math/Vector4f.hpp
	Include/Math/Matrix44f.hpp
	Include/Math/Quadratic.hpp
	Include/Math/Quaternionf.hpp
	Include/Math/Utilities.hpp
)

SET( MATH_DETAIL_FILES
	Include/Math/Detail/Ballistics_Impl.hpp
	Include/Math/Detail/Constants_Impl.hpp
	Include/Math/Detail/Point2i_Impl.hpp
	Include/Math/Detail/Point3f_Impl.hpp
	Include/Math/Detail/Vector3f_Impl.hpp
	Include/Math/Detail/Quadratic_Impl.hpp
	Include/Math/Detail/Quaternionf_Impl.hpp
	Include/Math/Detail/Matrix44f_Impl.hpp
	Include/Math/Detail/Utilities_Impl.hpp
)

SET( INCLUDE_FILES
	${MATH_INCLUDE_FILES}
	${MATH_DETAIL_FILES}
)

# ##########################################
SET( MATH_SOURCE_FILES
	Source/Math.cpp
)

SET( SOURCE_FILES
	${MATH_SOURCE_FILES}
)


# ##########################################
# Let's make things pretty in IDE's.
SOURCE_GROUP( "Math Includes" FILES ${MATH_INCLUDE_FILES} )
SOURCE_GROUP( "Math Includes\\Detail" FILES ${MATH_DETAIL_FILES} )
SOURCE_GROUP( "Math Source" FILES ${MATH_SOURCE_FILES} )


# ##########################################
ADD_LIBRARY( Math
	STATIC
	${INCLUDE_FILES}
	${SOURCE_FILES}
)

# ##########################################
#	Set the new target usage requirements.
#	Requires CMake 2.8.11.
TARGET_COMPILE_DEFINITIONS( Math
	PRIVATE		BUILDING_MATH
)
TARGET_INCLUDE_DIRECTORIES( Math
	PUBLIC ${CMAKE_CURRENT_LIST_DIR}/Include
)
TARGET_LINK_LIBRARIES( Math Core )


# ##########################################
# Group the libraries.
SET_PROPERTY( TARGET Math PROPERTY FOLDER Libraries )


# ##########################################
# Make a unit test holder for the Math library.
IF( BUILD_UNIT_TESTS )
	ADD_EXECUTABLE( _TestMath
		Tests/Main.cpp
		Tests/TestAll.hpp
		Tests/TestVector3f.hpp
		Tests/TestVector4f.hpp
		Tests/TestMatrix44f.hpp
		Tests/TestQuaternionf.hpp
		Tests/TestUtilities.hpp
	)
	TARGET_LINK_LIBRARIES( _TestMath Math GMock	)

	ADD_TEST( NAME _TestMath COMMAND _TestMath )

	# ##########################################
	# Group the tests.
	SET_PROPERTY( TARGET _TestMath PROPERTY FOLDER UnitTests )
ENDIF( BUILD_UNIT_TESTS )
